home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / NameRegistry.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  14.8 KB  |  550 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        NameRegistry.a
  3. ;
  4. ;    Contains:    NameRegistry Interfaces
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1993-1997 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
  19. __NAMEREGISTRY__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.  
  25. ; *******************************************************************************
  26. ; * 
  27. ; * Foundation Types
  28. ; *
  29.  
  30. ;  Value of a property 
  31. ; typedef void *                        RegPropertyValue
  32.  
  33. ;  Length of property value 
  34. ; typedef UInt32                         RegPropertyValueSize
  35.  
  36. ; *******************************************************************************
  37. ; * 
  38. ; * RegEntryID    :    The Global x-Namespace Entry Identifier
  39. ; *
  40.  
  41. RegEntryID                RECORD 0
  42. contents                 ds.l    4                ; offset: $0 (0)
  43. sizeof                     EQU *                    ; size:   $10 (16)
  44.                         ENDR
  45. ; typedef struct RegEntryID *            RegEntryIDPtr
  46.  
  47. ; *******************************************************************************
  48. ; *
  49. ; * Root Entry Name Definitions    (Applies to all Names in the RootNameSpace)
  50. ; *
  51. ; *    • Names are a colon-separated list of name components.  Name components
  52. ; *      may not themselves contain colons.  
  53. ; *    • Names are presented as null-terminated ASCII character strings.
  54. ; *    • Names follow similar parsing rules to Apple file system absolute
  55. ; *      and relative paths.  However the '::' parent directory syntax is
  56. ; *      not currently supported.
  57.  
  58. ;  Max length of Entry Name 
  59.  
  60. kRegCStrMaxEntryNameLength        EQU        47
  61. ;  Entry Names are single byte ASCII 
  62. ; typedef char                             RegCStrEntryName
  63.  
  64. ; typedef char *                        RegCStrEntryNamePtr
  65.  
  66. ;  length of RegCStrEntryNameBuf =  kRegCStrMaxEntryNameLength+1
  67. RegCStrEntryNameBuf        RECORD 0
  68. elements                 ds.b    48
  69. sizeof                     EQU *                    ; size:   $30 (48)
  70.                         ENDR
  71.  
  72.  
  73. ; typedef char                             RegCStrPathName
  74.  
  75. ; typedef UInt32                         RegPathNameSize
  76.  
  77.  
  78. kRegPathNameSeparator            EQU        58                    ; 0x3A 
  79. kRegEntryNameTerminator            EQU        $00                    ; '\0' 
  80. kRegPathNameTerminator            EQU        $00                    ; '\0' 
  81. ; *******************************************************************************
  82. ; *
  83. ; * Property Name and ID Definitions
  84. ; *    (Applies to all Properties Regardless of NameSpace)
  85.  
  86.  
  87. kRegMaximumPropertyNameLength    EQU        31                    ; Max length of Property Name 
  88. kRegPropertyNameTerminator        EQU        $00                    ; '\0' 
  89. RegPropertyNameBuf        RECORD 0
  90. elements                 ds.b    32
  91. sizeof                     EQU *                    ; size:   $20 (32)
  92.                         ENDR
  93.  
  94.  
  95. ; typedef char                             RegPropertyName
  96.  
  97. ; typedef char *                        RegPropertyNamePtr
  98.  
  99. ; *******************************************************************************
  100. ; *
  101. ; * Iteration Operations
  102. ; *
  103. ; *    These specify direction when traversing the name relationships
  104.  
  105. ; typedef UInt32                         RegIterationOp
  106.  
  107. ; typedef RegIterationOp                 RegEntryIterationOp
  108.  
  109.  
  110.                                                             ; Absolute locations
  111. kRegIterRoot                    EQU        $00000002            ; "Upward" Relationships    
  112. kRegIterParents                    EQU        $00000003            ; include all  parent(s) of entry 
  113.                                                             ; "Downward" Relationships
  114. kRegIterChildren                EQU        $00000004            ; include all children 
  115. kRegIterSubTrees                EQU        $00000005            ; include all sub trees of entry 
  116. kRegIterDescendants                EQU        $00000005            ; include all descendants of entry 
  117.                                                             ; "Horizontal" Relationships    
  118. kRegIterSibling                    EQU        $00000006            ; include all siblings 
  119.                                                             ; Keep doing the same thing
  120. kRegIterContinue                EQU        $00000001
  121. ; *******************************************************************************
  122. ; *
  123. ; * Name Entry and Property Modifiers
  124. ; *
  125. ; *
  126. ; *
  127. ; * Modifiers describe special characteristics of names
  128. ; * and properties.  Modifiers might be supported for
  129. ; * some names and not others.
  130. ; * 
  131. ; * Device Drivers should not rely on functionality
  132. ; * specified as a modifier.
  133.  
  134. ; typedef UInt32                         RegModifiers
  135.  
  136. ; typedef RegModifiers                     RegEntryModifiers
  137.  
  138. ; typedef RegModifiers                     RegPropertyModifiers
  139.  
  140.  
  141. kRegNoModifiers                    EQU        $00000000            ; no entry modifiers in place 
  142. kRegUniversalModifierMask        EQU        $0000FFFF            ; mods to all entries 
  143. kRegNameSpaceModifierMask        EQU        $00FF0000            ; mods to all entries within namespace 
  144. kRegModifierMask                EQU        $FF000000            ; mods to just this entry 
  145. ;  Universal Property Modifiers 
  146.  
  147. kRegPropertyValueIsSavedToNVRAM    EQU        $00000020            ; property is non-volatile (saved in NVRAM) 
  148. kRegPropertyValueIsSavedToDisk    EQU        $00000040            ; property is non-volatile (saved on disk) 
  149. ;  ///////////////////////
  150. ;//
  151. ;// The Registry API
  152. ;//
  153. ;/////////////////////// 
  154.  
  155. ;  ///////////////////////
  156. ;//
  157. ;// Entry Management
  158. ;//
  159. ;/////////////////////// 
  160.  
  161.  
  162. ; -------------------------------
  163. ; * EntryID handling
  164.  
  165. ; * Initialize an EntryID to a known invalid state
  166. ; *   note: invalid != uninitialized
  167.  
  168. ;
  169. ; extern OSStatus RegistryEntryIDInit(RegEntryID *id)
  170. ;
  171.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  172.         IMPORT_CFM_FUNCTION RegistryEntryIDInit
  173.     ENDIF
  174.  
  175. ; * Compare EntryID's for equality or if invalid
  176. ; *
  177. ; * If a NULL value is given for either id1 or id2, the other id 
  178. ; * is compared with an invalid ID.  If both are NULL, the id's 
  179. ; * are consided equal (result = true). 
  180.  
  181. ;
  182. ; extern Boolean RegistryEntryIDCompare(const RegEntryID *id1, const RegEntryID *id2)
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION RegistryEntryIDCompare
  186.     ENDIF
  187.  
  188. ; * Copy an EntryID
  189.  
  190. ;
  191. ; extern OSStatus RegistryEntryIDCopy(const RegEntryID *src, RegEntryID *dst)
  192. ;
  193.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  194.         IMPORT_CFM_FUNCTION RegistryEntryIDCopy
  195.     ENDIF
  196.  
  197. ; * Free an ID so it can be reused.
  198.  
  199. ;
  200. ; extern OSStatus RegistryEntryIDDispose(RegEntryID *id)
  201. ;
  202.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  203.         IMPORT_CFM_FUNCTION RegistryEntryIDDispose
  204.     ENDIF
  205.  
  206. ; -------------------------------
  207. ; * Adding and removing entries
  208. ; *
  209. ; * If (parentEntry) is NULL, the name is assumed
  210. ; * to be a rooted path. It is rooted to an anonymous, unnamed root.
  211.  
  212. ;
  213. ; extern OSStatus RegistryCStrEntryCreate(const RegEntryID *parentEntry, const RegCStrPathName *name, RegEntryID *newEntry)
  214. ;
  215.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  216.         IMPORT_CFM_FUNCTION RegistryCStrEntryCreate
  217.     ENDIF
  218.  
  219. ;
  220. ; extern OSStatus RegistryEntryDelete(const RegEntryID *id)
  221. ;
  222.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  223.         IMPORT_CFM_FUNCTION RegistryEntryDelete
  224.     ENDIF
  225.  
  226. ; ---------------------------
  227. ; * Traversing the namespace
  228. ; *
  229. ; * To support arbitrary namespace implementations in the future,
  230. ; * I have hidden the form that the place pointer takes.  The previous
  231. ; * interface exposed the place pointer by specifying it as a
  232. ; * RegEntryID.
  233. ; *
  234. ; * I have also removed any notion of returning the entries
  235. ; * in a particular order, because an implementation might
  236. ; * return the names in semi-random order.  Many name service
  237. ; * implementations will store the names in a hashed lookup
  238. ; * table.
  239. ; *
  240. ; * Writing code to traverse some set of names consists of
  241. ; * a call to begin the iteration, the iteration loop, and
  242. ; * a call to end the iteration.  The begin call initializes
  243. ; * the iteration cookie data structure.  The call to end the 
  244. ; * iteration should be called even in the case of error so 
  245. ; * that allocated data structures can be freed.
  246. ; *
  247. ; *    Create(...)
  248. ; *    do {
  249. ; *        Iterate(...);
  250. ; *    } while (!done);
  251. ; *    Dispose(...);
  252. ; *
  253. ; * This is the basic code structure for callers of the iteration
  254. ; * interface.
  255.  
  256.  
  257.  
  258.  
  259. ;  
  260. ; * create/dispose the iterator structure
  261. ; *   defaults to root with relationship = kRegIterDescendants
  262.  
  263. ;
  264. ; extern OSStatus RegistryEntryIterateCreate(RegEntryIter *cookie)
  265. ;
  266.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  267.         IMPORT_CFM_FUNCTION RegistryEntryIterateCreate
  268.     ENDIF
  269.  
  270. ;
  271. ; extern OSStatus RegistryEntryIterateDispose(RegEntryIter *cookie)
  272. ;
  273.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  274.         IMPORT_CFM_FUNCTION RegistryEntryIterateDispose
  275.     ENDIF
  276.  
  277. ;  
  278. ; * set Entry Iterator to specified entry
  279.  
  280. ;
  281. ; extern OSStatus RegistryEntryIterateSet(RegEntryIter *cookie, const RegEntryID *startEntryID)
  282. ;
  283.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  284.         IMPORT_CFM_FUNCTION RegistryEntryIterateSet
  285.     ENDIF
  286.  
  287. ; * Return each value of the iteration
  288. ; *
  289. ; * return entries related to the current entry
  290. ; * with the specified relationship
  291.  
  292. ;
  293. ; extern OSStatus RegistryEntryIterate(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done)
  294. ;
  295.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  296.         IMPORT_CFM_FUNCTION RegistryEntryIterate
  297.     ENDIF
  298.  
  299. ; * return entries with the specified property
  300. ; *
  301. ; * A NULL RegPropertyValue pointer will return an
  302. ; * entry with the property containing any value.
  303.  
  304. ;
  305. ; extern OSStatus RegistryEntrySearch(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  306. ;
  307.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  308.         IMPORT_CFM_FUNCTION RegistryEntrySearch
  309.     ENDIF
  310.  
  311. ; --------------------------------
  312. ; * Find a name in the namespace
  313. ; *
  314. ; * This is the fast lookup mechanism.
  315. ; * NOTE:  A reverse lookup mechanism
  316. ; *      has not been provided because
  317. ; *        some name services may not
  318. ; *        provide a fast, general reverse
  319. ; *        lookup.
  320.  
  321. ;
  322. ; extern OSStatus RegistryCStrEntryLookup(const RegEntryID *searchPointID, const RegCStrPathName *pathName, RegEntryID *foundEntry)
  323. ;
  324.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  325.         IMPORT_CFM_FUNCTION RegistryCStrEntryLookup
  326.     ENDIF
  327.  
  328. ; ---------------------------------------------
  329. ; * Convert an entry to a rooted name string
  330. ; *
  331. ; * A utility routine to turn an Entry ID
  332. ; * back into a name string.
  333.  
  334. ;
  335. ; extern OSStatus RegistryEntryToPathSize(const RegEntryID *entryID, RegPathNameSize *pathSize)
  336. ;
  337.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  338.         IMPORT_CFM_FUNCTION RegistryEntryToPathSize
  339.     ENDIF
  340.  
  341. ;
  342. ; extern OSStatus RegistryCStrEntryToPath(const RegEntryID *entryID, RegCStrPathName *pathName, RegPathNameSize pathSize)
  343. ;
  344.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  345.         IMPORT_CFM_FUNCTION RegistryCStrEntryToPath
  346.     ENDIF
  347.  
  348. ; * Parse a path name.
  349. ; *
  350. ; * Retrieve the last component of the path, and
  351. ; * return a spec for the parent.
  352.  
  353. ;
  354. ; extern OSStatus RegistryCStrEntryToName(const RegEntryID *entryID, RegEntryID *parentEntry, RegCStrEntryName *nameComponent, Boolean *done)
  355. ;
  356.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  357.         IMPORT_CFM_FUNCTION RegistryCStrEntryToName
  358.     ENDIF
  359.  
  360. ;  //////////////////////////////////////////////////////
  361. ;//
  362. ;// Property Management
  363. ;//
  364. ;////////////////////////////////////////////////////// 
  365.  
  366. ; -------------------------------
  367. ; * Adding and removing properties
  368.  
  369. ;
  370. ; extern OSStatus RegistryPropertyCreate(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  371. ;
  372.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  373.         IMPORT_CFM_FUNCTION RegistryPropertyCreate
  374.     ENDIF
  375.  
  376. ;
  377. ; extern OSStatus RegistryPropertyDelete(const RegEntryID *entryID, const RegPropertyName *propertyName)
  378. ;
  379.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  380.         IMPORT_CFM_FUNCTION RegistryPropertyDelete
  381.     ENDIF
  382.  
  383. ; ---------------------------
  384. ; * Traversing the Properties of a name
  385. ; *
  386.  
  387.  
  388.  
  389. ;
  390. ; extern OSStatus RegistryPropertyIterateCreate(const RegEntryID *entry, RegPropertyIter *cookie)
  391. ;
  392.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  393.         IMPORT_CFM_FUNCTION RegistryPropertyIterateCreate
  394.     ENDIF
  395.  
  396. ;
  397. ; extern OSStatus RegistryPropertyIterateDispose(RegPropertyIter *cookie)
  398. ;
  399.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  400.         IMPORT_CFM_FUNCTION RegistryPropertyIterateDispose
  401.     ENDIF
  402.  
  403. ;
  404. ; extern OSStatus RegistryPropertyIterate(RegPropertyIter *cookie, RegPropertyName *foundProperty, Boolean *done)
  405. ;
  406.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  407.         IMPORT_CFM_FUNCTION RegistryPropertyIterate
  408.     ENDIF
  409.  
  410. ; * Get the value of the specified property for the specified entry.
  411. ; *
  412.  
  413. ;
  414. ; extern OSStatus RegistryPropertyGetSize(const RegEntryID *entryID, const RegPropertyName *propertyName, RegPropertyValueSize *propertySize)
  415. ;
  416.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  417.         IMPORT_CFM_FUNCTION RegistryPropertyGetSize
  418.     ENDIF
  419.  
  420. ; * (*propertySize) is the maximum size of the value returned in the buffer
  421. ; * pointed to by (propertyValue).  Upon return, (*propertySize) is the size of the
  422. ; * value returned.
  423.  
  424. ;
  425. ; extern OSStatus RegistryPropertyGet(const RegEntryID *entryID, const RegPropertyName *propertyName, void *propertyValue, RegPropertyValueSize *propertySize)
  426. ;
  427.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  428.         IMPORT_CFM_FUNCTION RegistryPropertyGet
  429.     ENDIF
  430.  
  431. ;
  432. ; extern OSStatus RegistryPropertySet(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  433. ;
  434.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  435.         IMPORT_CFM_FUNCTION RegistryPropertySet
  436.     ENDIF
  437.  
  438. ;  //////////////////////////////////////////////////////
  439. ;//
  440. ;// Modibute (err, I mean Modifier) Management
  441. ;//
  442. ;////////////////////////////////////////////////////// 
  443.  
  444. ; * Modifiers describe special characteristics of names
  445. ; * and properties.  Modifiers might be supported for
  446. ; * some names and not others.
  447. ; * 
  448. ; * Device Drivers should not rely on functionality
  449. ; * specified as a modifier.  These interfaces
  450. ; * are for use in writing Experts.
  451.  
  452. ; * Get and Set operators for entry modifiers
  453.  
  454. ;
  455. ; extern OSStatus RegistryEntryGetMod(const RegEntryID *entry, RegEntryModifiers *modifiers)
  456. ;
  457.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  458.         IMPORT_CFM_FUNCTION RegistryEntryGetMod
  459.     ENDIF
  460.  
  461. ;
  462. ; extern OSStatus RegistryEntrySetMod(const RegEntryID *entry, RegEntryModifiers modifiers)
  463. ;
  464.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  465.         IMPORT_CFM_FUNCTION RegistryEntrySetMod
  466.     ENDIF
  467.  
  468. ; * Get and Set operators for property modifiers
  469.  
  470. ;
  471. ; extern OSStatus RegistryPropertyGetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers *modifiers)
  472. ;
  473.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  474.         IMPORT_CFM_FUNCTION RegistryPropertyGetMod
  475.     ENDIF
  476.  
  477. ;
  478. ; extern OSStatus RegistryPropertySetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers modifiers)
  479. ;
  480.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  481.         IMPORT_CFM_FUNCTION RegistryPropertySetMod
  482.     ENDIF
  483.  
  484. ; * Iterator operator for entry modifier search
  485.  
  486. ;
  487. ; extern OSStatus RegistryEntryMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegEntryModifiers matchingModifiers)
  488. ;
  489.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  490.         IMPORT_CFM_FUNCTION RegistryEntryMod
  491.     ENDIF
  492.  
  493. ; * Iterator operator for entries with matching 
  494. ; * property modifiers
  495.  
  496. ;
  497. ; extern OSStatus RegistryEntryPropertyMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegPropertyModifiers matchingModifiers)
  498. ;
  499.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  500.         IMPORT_CFM_FUNCTION RegistryEntryPropertyMod
  501.     ENDIF
  502.  
  503.  
  504.  
  505.     ENDIF ; __NAMEREGISTRY__ 
  506.  
  507.